package ca.uwaterloo.call;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class CallCardRegister extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.callcard);
		
		Button go = (Button) findViewById(R.id.button1);
		final TextView pre = (TextView) findViewById(R.id.editText1);
		Intent a = getIntent();
		pre.setText(a.getStringExtra("PRE"));
		final TextView phone = (TextView) findViewById(R.id.editText2);
		phone.setText(a.getStringExtra("PIN"));
		go.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				String pr = pre.getText().toString();
				String ph = phone.getText().toString();
				if (pr.length()*ph.length()>0) {
					Intent callback = new Intent();
					callback.putExtra("PRE",pr);
					callback.putExtra("PHO",ph);
					setResult(RESULT_OK,callback);
					finish();
				}
			}
		});
	}	
}
